// ##
#include "Timer.h"
// ## C++
#include <sstream>

namespace jm4bbx {
	static GlobalTimers::TimerRegistrator<PlainTimer> reg1("main");

	void PlainTimer::start() {
		time_ =  getActualTime();
			//ulibpp::system_info::get_relative_time();
	}

	Timer::TimeDurationType PlainTimer::meanTime() {
		//assert (time_ != 0);
		TimeType actualTtime = getActualTime();
		return actualTtime - time_;
	}

	void SumTimer::start() {
		timer_.start();
	}

	Timer::TimeDurationType SumTimer::meanTime() {
		TimeDurationType actualTtime = timer_.meanTime();
		sumTime_ += actualTtime;
		++lapCount_;
		return actualTtime;
	}

	TimerPtr GlobalTimers::getTimer(const std::string& timerName) {
		return (*timers_)[timerName];
	}

	GlobalTimers::GlobalTimersMap* GlobalTimers::timers_ = nullptr;//ew GlobalTimers::GlobalTimersMap;



} // namespace jm4bbx
